From 3fa9fedc39ea6f3e91e546151801daca150a6156 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Wed, 1 Jan 2014 05:46:19 +0000 Subject: [PATCH] Fixes for raymarine, netstumbler, skyforce. --- gpsbabel/netstumbler.cc | 13 +++---------- gpsbabel/raymarine.cc | 6 +++--- gpsbabel/skyforce.cc | 5 ++++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/gpsbabel/netstumbler.cc b/gpsbabel/netstumbler.cc index 83e06a1e7..d9e43deed 100644 --- a/gpsbabel/netstumbler.cc +++ b/gpsbabel/netstumbler.cc @@ -231,13 +231,13 @@ data_read(void) if (snmac) { snprintf(desc, sizeof desc, "%s/%d Mbps/Ch %d", ssid, speed, channel); - wpt_tmp->shortname = xstrdup(mac); + wpt_tmp->shortname = (mac); } else { snprintf(desc, sizeof desc, "%d Mbps/Ch %d/%s", speed, channel, mac); - wpt_tmp->shortname = xstrdup(ssid); + wpt_tmp->shortname = (ssid); } - wpt_tmp->description = xstrdup(desc); + wpt_tmp->description = desc; wpt_tmp->longitude = lon; wpt_tmp->latitude = lat; wpt_tmp->SetCreationTime(mktime(&tm)); @@ -326,14 +326,7 @@ fix_netstumbler_dupes(void) for (i = 0, bh = htable; i < ct; i++, bh++) { if (last_crc == bh->crc) { -#if NEW_STRINGS bh->wpt->shortname += QString("/%1").arg(++serial); -#else - char ssid[32 + 5 + 1]; - snprintf(ssid, sizeof ssid, "%s/%d", CSTRc(bh->wpt->shortname), ++serial); - xfree(bh->wpt->shortname); - bh->wpt->shortname = xstrdup(ssid); -#endif } else { last_crc = bh->crc; } diff --git a/gpsbabel/raymarine.cc b/gpsbabel/raymarine.cc index a44f4403c..b3a1fa6e5 100644 --- a/gpsbabel/raymarine.cc +++ b/gpsbabel/raymarine.cc @@ -208,14 +208,14 @@ raymarine_read(void) } wpt = waypt_new(); - wpt->shortname = xstrdup(name); + wpt->shortname = name; wpt->latitude = atof(lat); wpt->longitude = atof(lon); waypt_add(wpt); /* try to read optional values */ if (((str = inifile_readstr(fin, sect, "Notes"))) && *str) { - wpt->notes = xstrdup(str); + wpt->notes = str; } if (((str = inifile_readstr(fin, sect, "Time"))) && *str) { wpt->SetCreationTime(EXCEL_TO_TIMET(atof(str))); @@ -244,7 +244,7 @@ raymarine_read(void) } rte = route_head_alloc(); - rte->rte_name = xstrdup(name); + rte->rte_name = name; route_add_head(rte); for (wx = 0; wx < 0x3FFF; wx++) { diff --git a/gpsbabel/skyforce.cc b/gpsbabel/skyforce.cc index 6c53b7cbb..1ac4a039a 100644 --- a/gpsbabel/skyforce.cc +++ b/gpsbabel/skyforce.cc @@ -78,7 +78,10 @@ skyforce_parse_wpt(const char* str, int* rte_num) return NULL; } - wpt->shortname = lrtrim(xstrndup(str + 10, 9)); + // The line has fixed columns and starts like: + // R 001 029 BEARHILL N42... + // Grab "BEARHILL" and whack trailing space. + wpt->shortname = QString(str).mid(10,9).trimmed(); if (rte_num) { *rte_num = atoi(str + 2); -- 2.30.2